Repository navigation
fix(service-automation)!: automation variable keys cannot use reserved object segments, and one run's writes never change a flow's defaults - #38001
Conversation
…d object segments A flow variable key, and every dot-separated part of one, may not be `__proto__`, `constructor` or `prototype`. Two doors hold the rule: - registration (and the stored pass that previews it) refuses a flow that declares, assigns or binds such a key, naming each site; - resume refuses a signal whose `output` or `inputs` carry such a key with INVALID_SIGNAL, before anything reads the submitted values, so nothing is applied and the pause stays live. Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
…lts or another run's values - A dotted write whose head names a value the run holds lands in a copy the expression scope owns; the run reads it back, and the held value (a declared default, the trigger record, the value `record` and `$record` share) keeps what it was. - Each run binds its own copy of an object or list default. - With no durable store, a paused run is handed out with its own copy of its variables, as a stored run is, so a resume writes into nothing the parked run shared. Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
…ngeset Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
…ent keys for every caller Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
… and stays paused Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 12 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 182 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 845a8eab44db5dfb256d3a0c9335337ee0063dfa && git checkout 845a8eab44db5dfb256d3a0c9335337ee0063dfa
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8d34c4404f951410083a6caebd6ad8003ea3423d 82e81476d6c0504f48946e53f0938773584ce359 && git checkout -B drift-repro 8d34c4404f951410083a6caebd6ad8003ea3423d && git merge --no-ff 82e81476d6c0504f48946e53f0938773584ce359
node scripts/docs-audit/affected-docs.mjs --json 8d34c4404f951410083a6caebd6ad8003ea3423d
|
…mes and INVALID_SIGNAL are described; declare the narrowing Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
… ledger Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
|
security#1 · os-mickey · session_01ASNY8XNef4ywkQio6S9ju4 Contract reviewServed-tier: Inputs: the governing ruling (two halves: the door, and P2), the PR body, its 14-file list, the net diff Gate verdicts: every completed check-run on this head is ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe ruling, sentence by sentence.
One must-fix (M1), four should-fix (S1–S4), three nits. The resume door and the default-isolation half hold as ruled; the authoring door does not yet refuse every key a flow names, so the narrowing is not delivered whole at this head. Implemented-by: VERDICT: FAIL |
… registration, exempt the engine's own continuations at resume, and give each run its own trigger record - Registration judges node ids, object-form screen idVariable, and each name with surrounding whitespace trimmed; the judged positions are held equal to the spec's binding positions. - Resume judges a caller's signal only; the engine's own continuations still complete. - Each run binds its own copy of the trigger record. - A run value that contains itself is refused by the copy by name, and a held run carrying one still resumes. Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
…s own record copy carries the declared lookups Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4 Co-authored-by: Claude <noreply@anthropic.com>
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no published skill teaches a flow variable name, assignment target, screen field name or resume-signal key rule (checked:
git grepoverskills/**for__proto__,constructor,prototype, and the automation skill's variable,outputVariable, assignment, screen-field and resume text; the only hits areskills/objectuiexpression-sandbox lists, unrelated)维护者速读
What changes
Three rules, stated once each in the automation service:
__proto__,constructororprototypeas its name or as any dot-separated part of it — at registration. Registration, and the stored pass that previews it, judges every key a flow names: each declared variable'sname, eachassignmentnode's targets in every shape, each node'soutputVariable/iteratorVariable/indexVariable/errorVariable, and eachscreenfield'sname. The refusal names every such key and where it sits. A name that only contains one of the words (constructor_name) is unaffected.outputand ofinputsis judged first, before anything reads the submitted values; the answer isINVALID_SIGNAL(400), nothing is applied, and the run stays paused for a valid submission. The resume chokepoint refuses the same keys for every caller.$record). With no durable store, a resumed run works on its own copy of its variables, as a stored run does.Commits: the door half (rules 1 and 2), then rule 3, then the docs page and changeset, then one more pin for the chokepoint, then a dogfood pin updated, then the published prose and the ledger entry.
packages/qa/dogfood/test/flow-condition-scope-keys.dogfood.test.ts(a screen resume'sinputsandoutputbags) stated the earlier accept set and goes red under this change; it now states the ruled one — refused withINVALID_SIGNAL, the run stays paused, and the valid submission then lands.packages/spec/src/automation/builtin-node-config.zod.ts, theINVALID_SIGNALdescription inpackages/spec/src/contracts/automation-service.ts, and the resume route's status note inpackages/runtime/src/domains/automation.ts.flow-variable-key-reserved-segment-refused(packages/spec/src/migrations/entries/semantic/), soos migrate metaand the upgrade guide carry the rename; the changeset is markedregisteredwith it. The changeset isminoron@objectstack/service-automation(the kindnarrowed),patchon@objectstack/specand@objectstack/runtime.Tests
src/variable-key-reserved-segments.test.ts— rules 1 and 2: each sample is refused at registration and listed by the stored pass; each resume sample is refused on a screen (the screen's conditions are never evaluated, the paused variables are byte-identical, and the valid submission then lands) and on a pause with no input contract; the chokepoint refuses them as a whole. Controls: ordinary dotted keys and names containing the words register, run and resume.src/run-values-isolation.test.ts— rule 3: object and list defaults (dotted writes, list index and length, a node that changes the value in place), the trigger record against$record, and a paused run with and without a store.5cd060c9d6d(existing flow suites with ordinary dotted keys unchanged). The commits after it change no service-automation source.Reverse verification — each new pin, one change reverted at a time (counts only)
Each leg through
scripts/ablation-replace.mjs(anchor x1 -> x0, restored to HEAD,git diff HEADempty after every leg), on the two new files (50 tests):Acceptance notes
Verification
First read (by risk):
packages/services/service-automation/src/run-resume.ts— the resume-door block just before the screen contract.packages/services/service-automation/src/flow-registration-checks.ts—validateVariableKeySegments.packages/services/service-automation/src/dag-traversal.ts— the descent incelScopeand the default seeding.Two-minute check:
pnpm --filter @objectstack/service-automation exec vitest run src/variable-key-reserved-segments.test.ts src/run-values-isolation.test.ts— expectTests 50 passed (50).Local gates at the final head c213f8f
@objectstack/service-automationtypecheck (tsc and the test-layer typecheck): exit 0 (at 5cd060c; its sources are unchanged since).@objectstack/specbuild,check:generated(every artifact up to date) and typecheck: exit 0;src/migrationstests 203/203.@objectstack/runtimetypecheck: exit 0.check:adr-0087-registration: exit 0,registered flow-variable-key-reserved-segment-refused (new here).check-changeset-no-major: exit 0 (its level axis reads the PR body in CI).dispatch-gates --commands, 125 families): 122 exit 0; 3 NOT MEASURED, prerequisite not met on this box (exit 3):check:skill-examples(no client SDK build),check:dual-build-cjs-loads(no full build),check:type-check-debt(its inner lock call queued behind this branch's own battery). The non-self-testcheck:dev-prereqsreads this worktree as not fully built (39 packages without dist), the same prerequisite. CI runs all of them.--ranreconciliation: 125 derived, 125 run, 0 unrun.Dogfood battery at the final head c213f8f
pnpm --filter '@objectstack/dogfood^...' build, exit 0), thenpnpm --filter @objectstack/dogfood testunder the verify lock, no shard: exit 0 · Test Files 490 passed / 3 skipped (493) · Tests 4144 passed / 68 skipped (4212).Generated by Claude Code